-
Notifications
You must be signed in to change notification settings - Fork 2
/
WcsCSpn.c
52 lines (35 loc) · 1.32 KB
/
WcsCSpn.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*++
toro C Library
https://github.com/KilianKegel/toro-C-Library#toro-c-library-formerly-known-as-torito-c-library
Copyright (c) 2017-2024, Kilian Kegel. All rights reserved.
SPDX-License-Identifier: GNU General Public License v3.0
Module Name:
WcsCSpn.c
Abstract:
Implementation of the Standard C function.
Returns the index of the first occurrence in a string, of a character that belongs to a set of characters.
Author:
Kilian Kegel
--*/
#include <CdeServices.h>
/**
Synopsis
#include <wchar.h>
size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
Description
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcspn-wcscspn-mbscspn-mbscspn-l?view=msvc-160
The wcscspn function computes the length of the maximum initial segment of the wide
string pointed to by s1 which consists entirely of wide characters not from the wide
string pointed to by s2.
Returns
The wcscspn function returns the length of the segment.
@param[in] char *s1
@param[in] char *s2
@retval size_t, lenght of block
**/
size_t wcscspn(const wchar_t* pszStr, const wchar_t* pszSet) {
CDE_APP_IF* pCdeAppIf = __cdeGetAppIf();
wchar_t* p;
p = (wchar_t*)pCdeAppIf->pCdeServices->pWcsStrPbrkSpn(WID, (void*)pszStr, (void*)pszSet);
return p ? p - pszStr : 0;
}